<?php

class Username
{
	/**
	*@var string
	**/
	private $username;

	/**
	*@var int const
	**/
	const Min_Username_length = 5;
	/**
	*@var int const
	**/
	const Max_Username_length = 15;

	/**
	*@param string
	**/
	public function __construct($username)
	{
		if(strlen($username) >= self::Min_Username_length && 
		   strlen($username) <= self::Max_Username_length)
		{
			$this->username = $username;
		}
		else
		{
			throw new Exception("Ett fel uppstod i skapande av användarnamn");
		}
	}

	/**
	*@return string
	**/
	public function getUsername()
	{
		return $this->username;
	}

}